package com.demo.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.tencent.mm.opensdk.modelpay.PayReq;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PayReq payReq = new PayReq();


                IWXAPI iwxapi = WXAPIFactory.createWXAPI(getApplicationContext(), "", false);
                payReq.appId="22222";
                payReq.extData="";
                payReq.nonceStr="111";
                payReq.packageValue="11111";
                payReq.openId="---";
                payReq.signType="sign=wechat";
                payReq.timeStamp="---";
                payReq.sign="111";
                payReq.prepayId="000";
                payReq.partnerId="1111";

                iwxapi.sendReq(payReq);

            }
        });
    }
}
